<template>
  <view class="">
    <u-collapse :value="activeKey">
      <u-collapse-item :title="item.title" name="1" v-for="(item, index) in collapseList" :key="index">
        <view class="">
          <u-list height="100%">
            <u-list-item v-for="(e, i) in item.contentList" :key="i">
              <u-cell :title="e.name" @click="details(e)">
                <clLcons slot="icon" :color="color" :type="e.icon" class="m-r-15"></clLcons>
                <clLcons slot="right-icon" color="#c8c9cc" size="18" :type="e.rightIcon" @click.native.stop="iconClick(e)"></clLcons>
              </u-cell>
            </u-list-item>
          </u-list>
        </view>
      </u-collapse-item>
    </u-collapse>
    <u-toast ref="uToast"></u-toast>
  </view>
</template>

<script>
import { clotnListArrOne } from "./utils/list";
import clLcons from "@/components/cl-icon/cl-icon.vue";
export default {
  data() {
    return {
      collapseList: null,
      color:'#3d7ff7',
      activeKey: ["1"]
    };
  },
  components: {
    clLcons,
  },
  mounted() {
    this.collapseList = clotnListArrOne;
  },
  methods: {
    details(item) {
      console.log("item",item);
      if (!item.route) {
        this.$refs.uToast.show({
          type: 'default',
          message: '正在开发中',
        })
        return
      }
      // 先清除在产页面等
      this.$ls.remove('xsdInformation')
      this.$ls.remove('cgdInformation')
      this.$ls.remove('thjsInformation')
      this.$ls.remove('khddInformation')
      this.$ls.remove('cgdreturnInformation')
      this.$ls.remove('dbdInformation')
      // 单独为调拨单创建数据结构
      const data = {
        supplier: item, // 调拨单数据
        productInformation: [], // 产品数据 { warehouse 仓库信息 , product : 产品信息}
      }
      this.$ls.set('dbdInformation', data)
      this.$Router.push({
        path: item.route,
      });
    },
    iconClick(val) {
      if (val.nextRoute) {
        this.$Router.push({
          path: val.nextRoute,
        });
      }
    },
    btnListSaleOrder() {
      // console.log("btnListSaleOrder");
      this.$Router.push({
        name: "SaleOrderList",
      });
    },
    btnPrintLabel() {
      // console.log("btnPrintLabel");
      this.$Router.push({
        name: "GoodsLabel",
      });
    },
  },
};
</script>

<style scoped>
.u-collapse-item__content__text {
  padding: 0;
}
</style>
